﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace vidu2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void btnCong_Click(object sender, EventArgs e)
        {
            int tu1 = int.Parse(txtTu1.Text);
            int mau1 = int.Parse(txtMau1.Text);
            int tu2 = int.Parse(txtTu2.Text);
            int mau2 = int.Parse(txtMau2.Text);
            PhanSo ps1 = new PhanSo(tu1, mau1);
            PhanSo ps2 = new PhanSo(tu2, mau2);
            PhanSo kq = ps1.Tong(ps2);
            lbKetQua.Text = kq.Chuoi();
        }

        private void btnTru_Click(object sender, EventArgs e)
        {
            int tu1 = int.Parse(txtTu1.Text);
            int mau1 = int.Parse(txtMau1.Text);
            int tu2 = int.Parse(txtTu2.Text);
            int mau2 = int.Parse(txtMau2.Text);
            PhanSo ps1 = new PhanSo(tu1, mau1);
            PhanSo ps2 = new PhanSo(tu2, mau2);
            PhanSo kq = ps1.Hieu(ps2);
            lbKetQua.Text = kq.Chuoi();
        }

        private void btnNhan_Click(object sender, EventArgs e)
        {
            int tu1 = int.Parse(txtTu1.Text);
            int mau1 = int.Parse(txtMau1.Text);
            int tu2 = int.Parse(txtTu2.Text);
            int mau2 = int.Parse(txtMau2.Text);
            PhanSo ps1 = new PhanSo(tu1, mau1);
            PhanSo ps2 = new PhanSo(tu2, mau2);
            PhanSo kq = ps1.Tich(ps2);
            lbKetQua.Text = kq.Chuoi();
        }

        private void btnChia_Click(object sender, EventArgs e)
        {
            int tu1 = int.Parse(txtTu1.Text);
            int mau1 = int.Parse(txtMau1.Text);
            int tu2 = int.Parse(txtTu2.Text);
            int mau2 = int.Parse(txtMau2.Text);
            PhanSo ps1 = new PhanSo(tu1, mau1);
            PhanSo ps2 = new PhanSo(tu2, mau2);
            PhanSo kq = ps1.Thuong(ps2);
            lbKetQua.Text = kq.Chuoi();
        }
    }
}
